<?php
/**
 * Created by PhpStorm.
 * User: Kevin
 * Date: 2018/10/7
 * Time: 18:31
 */
namespace app\admin\model;
use think\Db;
use think\Model;
class CommodityModel extends Model
{
    protected $name = "goods";

    public function getCommodityData($map,$Nowpage, $limits){
        return $this->alias ('g')
            ->join('shops s','g.g_shop = s.s_id','left')
            ->where($map)
            ->field('g_id,g_name,g_thumb,g_price_now,s_name,g_status,g_pack,g_weight,g_stock,g_canbuy,g_num,g_score,g_time,s.s_phone')
            ->page($Nowpage,$limits)
            ->select();
    }

    public function getCommodityCount($map){
        return $this->alias ('g')
            ->join('shops s','g.g_shop = s.s_id','left')
            ->where($map)
            ->count();
    }
}